<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Tartisan</title>
    <!-- zui -->
    <link href="/res/zui/dist/css/zui.min.css" rel="stylesheet">
    <style type="text/css">
       #login-container{
          margin-top: 200px;
       }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-sm-offset-4 col-xs-4">
                <div class="panel panel-primary" id="login-container">
                    <div class="panel-heading">Login Tartisan Admin Portal</div>
                    <div class="panel-body">
                        <form class="form-horizontal" id="loginForm">
                            <div class="form-group">
                                <label for="loginName" class="col-xs-4 required">Name</label>
                                <div class="col-xs-6">
                                    <input type="text" class="form-control" id="loginName" name="loginName" placeholder="Login name">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-xs-4 required">Password</label>
                                <div class="col-xs-6">
                                    <input type="password" class="form-control" id="password" name="password" placeholder="Password">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-4 col-xs-6">
                                    <button type="button" class="btn btn-primary" onclick="loginSystem();"><i class="icon icon-key"></i> Login</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

<script src="/res/jquery/jquery.js"></script>
<script src="/res/zui/dist/js/zui.min.js"></script>
<script type="text/javascript" src="${ctx}/res/bootbox/bootbox.min.js"></script>
<script type="text/javascript">
    function loginSystem(){
        var dialog = bootbox.dialog({
            message: '<div class="text-center"><i class="icon icon-spin icon-spinner"></i> Please wait...</div>',
            closeButton: false,
            size: 'small'
        });
        $.post('${ctx}/login',$('#loginForm').serialize(),function(data){
            dialog.modal('hide');
           if(data.success){
               location.href='${ctx}/admin/pae/list';
           } else{
               new $.zui.Messager(data.errmsg).show();
           }
        });
    }
</script>
</body>
</html>